//static一旦创建就不会被释放，并且总是拥有最新的值
//static is not released once created and always has the latest value

// NOLINTBEGIN

#include <iostream>
#include <string>
using namespace std;
class Student {
 public:
  Student(string ns, int nums, double scores) : nameS(ns), num(nums), score(scores) {};
  static void getAverage()  //A shared method of a class
  {
    cout << totalScore / countS << endl;
    ;
  }
  void get_totalScore(Student s1) {
    totalScore = totalScore + s1.score;
    countS++;
  }
  static void display_totalScore() {
    cout << totalScore << endl;
  }

 private:
  string nameS;
  int num;
  double score;
  static int countS;         //Shared data member
  static double totalScore;  //Shared data member
};
double Student::totalScore = 0;
int Student::countS        = 0;

int main() {
  Student stu[4] = {Student("XXXX", 1000, 0),
                    Student("ZhangSan", 1001, 100),
                    Student("LiSi", 1002, 200),
                    Student("WangWu", 1003, 300)};
  for (int i = 1; i < 4; i++) {
    stu[0].get_totalScore(stu[i]);
  }
  Student::display_totalScore();
  Student::getAverage();
  stu[3].display_totalScore();
  stu[3].getAverage();
  stu[2].display_totalScore();
  stu[2].getAverage();
  //system("pause");
  return 0;
}
// NOLINTEND